<?php
	require_once("web_fns.php");
	$search_content = $_POST['search_content'];
	//去掉字符串中的空格
	$search_content = str_replace(' ','',$search_content);
	$conn = db_connect();
	$conn->query("set names utf8");
	$result = $conn->query("select car_brand,car_class,brand_name from ".$car_dataset." where brand_name like '%".$search_content."%'");
	$result_num = $result->num_rows;
	if($result_num==0) {
		//未搜索到结果
		echo 0;
	}
	else {
		$row = $result->fetch_assoc();
		$result_arr =explode(" ",$row['brand_name']);
		$pos = strrpos($result_arr[0],$search_content);
		if($pos === false) {
			echo $row['car_brand'].','.$row['car_class'];
		}
		else {
			echo $row['car_brand'];
		}
	}
?>